<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta http-equiv="content-style-type" content="text/css"/>
<meta http-equiv="content-script-type" content="text/javascript"/>
<meta name="version" content="neblog-1.0"/>
<title>hikerwu</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="js/tool.js"></script>
<style>
    .dataout { width:100%; height:660px;overflow-x:scroll;}
</style>
</head>
<body>

<div>
    <p>url: <input id="data_in" size="150" value="<!--{$out.url}-->" class="datain" onkeydown="if (event.keyCode==13) getComments(this.value);"/>
    <div>
    <p><button id="b_pre">pre</button><button id="b_next">next</button><button id="b_go">go</button>&nbsp;<select id="s_ch">
        <option value="">请选择</option>
        <option value="new">new</option>
        <option value="hot">hot</option>
    </select></p>
    <!--{if $out.contents }-->
    <!--{section name=t start=0 loop=$out.contents}-->
        <!--{$smarty.section.t.index}-->,
        <!--{assign var="arr" value=$out.contents[t]}-->
        <b><u id="a_go" style="color:black;cursor:pointer" href="http://t.qq.com/<!--{$arr.userInfo.name}-->"><!--{$arr.userInfo.nick}--><!--{if $arr.userInfo.vip == 1}-->[<u style="color:yellow">V</u><!--{$arr.userInfo.level}-->]<!--{/if}--></u></b>[<!--{$arr.content}-->]
        </span><br>
    <!--{/section}-->
    <!--{/if}-->
    <p><button id="b_pre">pre</button><button id="b_next">next</button><button id="b_go">go</button></p>
    </div>
</div>
<script type="text/javascript">

var g_params = getUrlParams();

$("#s_ch").val("<!--{$out.type}-->");
$().ready(function(){
    $("[id='b_pre']").attr( 'disabled', (g_params['page']>1) ? false : true );
    $("[id='b_next']").attr( 'disabled', '<!--{$out.bnext}-->'=='1' ? false : true );
    $("[id='b_pre']").click(function(){
        var page = g_params['page'] ? g_params['page'] : 0;
        page = parseInt( page );
        chngPage( page-1 );
    });
    $("[id='b_next']").click(function(){
        var page = g_params['page'] ? g_params['page'] : 1;
        page = parseInt( page );
        chngPage( page+1 );
    });
    $("[id='a_go']").click(function(){
         $('#data_in').onkeydown();
    });
    $("#s_ch").change(function(){
        var type = $(this).val();
        var url = $("#data_in").val();
        window.location.href = '/hiker/?m=CComment&type='+type+'&url='+url;
    });
});

function getUrlParams()
{
    var search = window.location.search ; 
    // 写入数据字典
    var tmparray = search.substr(1,search.length).split("&");
    var paramsArray = new Array; 
    if( tmparray != null)
    {
        for(var i = 0;i<tmparray.length;i++)
        {
            var reg = /[=|^==]/;    // 用=进行拆分，但不包括==
            var set1 = tmparray[i].replace(reg,'&');
            var tmpStr2 = set1.split('&');
            paramsArray[tmpStr2[0]] = tmpStr2[1] ; 
        }
    }
    // 将参数数组进行返回
    return paramsArray ;     
}

function getComments( url )
{
    window.location.href = '/hiker/?m=CComment&type=new&url='+url;
}

function chngPage( page )
{
    var link = window.location.href;
    link = link.replace(/&page=[0-9\-+]*/, '');
    link = link+'&page='+page;
    window.location.href = link;
}

</script>

</body>
</html>
